package www.openteam.com.api;


import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Observable;
import www.openteam.com.bean.ApprovalStatu;
import www.openteam.com.bean.CustomOrder;
import www.openteam.com.bean.CustomType;
import www.openteam.com.bean.DeleteInfo;
import www.openteam.com.bean.DeleteWholeInfo;
import www.openteam.com.bean.DeliverGoods;
import www.openteam.com.bean.InsertStatus;
import www.openteam.com.bean.OrderApproval;
import www.openteam.com.bean.PackTypeInfo;
import www.openteam.com.bean.PayableApproval;
import www.openteam.com.bean.PbProductInfo;
import www.openteam.com.bean.ProOrder;
import www.openteam.com.bean.ProStock;
import www.openteam.com.bean.ProducePro;
import www.openteam.com.bean.ProductInfo;
import www.openteam.com.bean.QueryCustom;
import www.openteam.com.bean.ReceivableApproval;
import www.openteam.com.bean.Result;
import www.openteam.com.bean.SomeCustomInfo;
import www.openteam.com.bean.TakeDeliverGoods;
import www.openteam.com.bean.User;


public interface UserApiService {
//    @GET("/some/endpoint")
//    Call<SomeResponse> someEndpoint(
//            @QueryMap Map<String, String> dynamic);

// 方法调用
//    someService.someEndpoint(
//            Collections.singletonMap("dynamic", "query"));


    // 请求用户名
    @GET("UserList/names_re")
    Observable<User> getUserData(@Query("pageSize") int pageSize);

    //提交密码和用户名
    @FormUrlEncoded
    @POST("UserList/check_pwd")
    Observable<Result> login(@Field("name") String name, @Field("pass") String password);



    //查询收货进度
    @GET("QueryPro/queryPro")
    Observable<DeliverGoods> queryDeliverGoods(@Query("rdsno") String rdsno, @Query("custid") String custid, @Query("startDate") long startDate, @Query("endDate") long endDate, @Query("pageSize") int PageSize);

    @GET("QueryTDG/queryTDG")
    Observable<TakeDeliverGoods> queryTDeliverGoods(@Query("rdsno") String rdsno, @Query("custid") String custid, @Query("startDate") long startDate, @Query("endDate") long endDate, @Query("pageSize") int PageSize);

    @GET("QueryPrud/queryPrud")
    Observable<ProducePro> queryProd(@Query("rdsno") String rdsno, @Query("custid") String custid, @Query("code") String code, @Query("startDate") long startDate, @Query("endDate") long endDate, @Query("pageSize") int PageSize);

    @GET("QueryStock/queryStock")
    Observable<ProStock> queryStock(@Query("rdsno") String rdsno, @Query("pageSize") int PageSize);

    // OrderApproval/orderApproval?custorderid=&custid=M&orderStatus=&startDate=1315152000000&endDate=&pageSize=0
    @GET("OrderApproval/orderApproval")
    Observable<OrderApproval> queryOrder(@Query("custorderid") String custorderid, @Query("custid") String custid, @Query("orderStatus") String orderStatus, @Query("startDate") long startDate, @Query("endDate") long endDate, @Query("pageSize") int PageSize);

    //http://openteam.tpddns.cn:8090/index.php/OpenTeam/PrOrderApproval/prOrderApproval?rdsno&code=&orderStatus=&startDate=1418486400000&endDate=&pageSize=0
    @GET("PrOrderApproval/prOrderApproval")
    Observable<ProOrder> queryPrOrder(@Query("rdsno") String rdsno, @Query("code") String code, @Query("orderStatus") String orderStatus, @Query("startDate") long startDate, @Query("endDate") long endDate, @Query("pageSize") int PageSize);

    @GET("ReceivableApproval/receivableApproval")
    Observable<ReceivableApproval> queryReceivableApproval(@Query("custid") String custid, @Query("startDate") long startDate, @Query("endDate") long endDate, @Query("pageSize") int PageSize);

    @GET("PayableApproval/payableApproval")
    Observable<PayableApproval> queryPayableApproval(@Query("vendno") String vendno, @Query("startDate") long startDate, @Query("endDate") long endDate, @Query("pageSize") int PageSize);

    //ApprovalUpdate/approvalUpdate?id=17183
    @GET("ApprovalUpdate/approvalUpdate")
    Observable<ApprovalStatu> approvalStatu(@Query("id") int id);


    @GET("ApprovalUpdate/unprApprovalUpdate")
    Observable<ApprovalStatu> unprApprovalUpdate(@Query("id") int id);

    @GET("ApprovalUpdate/reApprovalUpdate")
    Observable<ApprovalStatu> reApprovalUpdate(@Query("id") int id);

    @GET("ApprovalUpdate/unReApprovalUpdate")
    Observable<ApprovalStatu> unReApprovalUpdate(@Query("id") int id);

    @GET("ApprovalUpdate/paApprovalUpdate")
    Observable<ApprovalStatu> paApprovalUpdate(@Query("id") int id);

    @GET("ApprovalUpdate/unPaApprovalUpdate")
    Observable<ApprovalStatu> unPaApprovalUpdate(@Query("id") int id);

    @GET("ApprovalUpdate/prApprovalUpdate")
    Observable<ApprovalStatu> prApprovalUpdate(@Query("id") int id);


    @GET("ApprovalUpdate/unapprovalUpdate")
    Observable<ApprovalStatu> unapprovalStatu(@Query("id") int id);

    @GET("QueryProductInfo/querypbMaterialTypelst")
    Observable<CustomType> queryMaterialTypelst();

    @GET("QueryProductInfo/queryProductInfo")
    Observable<ProductInfo> queryProductInfo(@Query("code") String code, @Query("name") String name, @Query("pageSize") int PageSize);

    @GET("QueryCocustom/queryCocustom")
    Observable<QueryCustom> queryCocustomInfo(@Query("code") String code, @Query("name") String name, @Query("Businessman") String Businessman, @Query("pageSize") int PageSize);

    @GET("QueryCocustom/queryCustomType")
    Observable<CustomType> queryCocustomTypeInfo(@Query("pageSize") int PageSize);


    @GET("QueryCocustom/queryCopayType")
    Observable<CustomType> queryCopayTypeInfo(@Query("pageSize") int PageSize);

    @GET("QueryCocustom/queryMoneyType")
    Observable<CustomType> queryMoneyTypeInfo(@Query("pageSize") int PageSize);

    @GET("QueryCocustom/querySendType")
    Observable<CustomType> querySendTypeInfo(@Query("pageSize") int PageSize);

    @FormUrlEncoded
    @POST("InsertCustomInfo/insertCustomInfo")
    Observable<InsertStatus> insertCustomInfo(@Field("code") String code, @Field("name") String name,
                                              @Field("type") String type, @Field("paytime") String paytime,
                                              @Field("moneytype") String moneytype, @Field("SendAddress") String SendAddress,
                                              @Field("connecter") String connecter, @Field("BusinessMan") String BusinessMan,
                                              @Field("CreditNumb") String CreditNumb, @Field("cTel") String cTel);

    @FormUrlEncoded
    @POST("InsertCustomInfo/updateCustomInfo")
    Observable<InsertStatus> updateCustomInfo(@Field("code") String code, @Field("name") String name,
                                              @Field("type") String type, @Field("paytime") String paytime,
                                              @Field("moneytype") String moneytype, @Field("SendAddress") String SendAddress,
                                              @Field("connecter") String connecter, @Field("BusinessMan") String BusinessMan,
                                              @Field("CreditNumb") String CreditNumb, @Field("cTel") String cTel, @Field("id") int id);


    @FormUrlEncoded
    @POST("InsertProductInfo/insertProductInfo")
    Observable<InsertStatus> insertProductInfo(@Field("code") String code, @Field("name") String name,
                                               @Field("type") String type, @Field("ccode") String ccode,
                                               @Field("length") String length, @Field("width") String width,
                                               @Field("height") String height, @Field("unit") String unit,
                                               @Field("maxstock") String maxstock, @Field("typename") String typename,
                                               @Field("CoverPage") String CoverPage, @Field("contentpage") String contentpage, @Field("minstock") String minstock);

    @FormUrlEncoded
    @POST("InsertProductInfo/updateProductInfo")
    Observable<InsertStatus> updateProductInfo(@Field("code") String code, @Field("name") String name,
                                               @Field("type") String type, @Field("ccode") String ccode,
                                               @Field("length") String length, @Field("width") String width,
                                               @Field("height") String height, @Field("unit") String unit,
                                               @Field("maxstock") String maxstock, @Field("typename") String typename,
                                               @Field("CoverPage") String CoverPage, @Field("contentpage") String contentpage, @Field("minstock") String minstock);

    @FormUrlEncoded
    @POST("InsertCustomInfo/deleteCustomInfo")
    Observable<InsertStatus> deleteCustomInfo(@Field("id") int id);

    @FormUrlEncoded
    @POST("InsertProductInfo/deleteProductInfo")
    Observable<InsertStatus> deleteProductInfo(@Field("code") String code);


    //192.168.1.6:8090/index.php/OpenTeam/InsertCustomOrderInfo/queryCustomOrderInfo?rdsno=&custid=2&pageSize=0

    /**
     *  客户订单信息查询
     * @param rdsno  订单号
     * @param custid  客户编号
     * @param pageSize  页
     * @return
     */
    @GET("InsertCustomOrderInfo/queryCustomOrderInfo")
    Observable<CustomOrder> queryCustomOrderInfo(@Query("rdsno") String rdsno,
                                                 @Query("custid") String custid,
                                                 @Query("pageSize") int pageSize);


//    192.168.1.6:8090/index.php/OpenTeam/InsertCustomOrderInfo/deleteCustomItemOrderInfo
    @FormUrlEncoded
    @POST("InsertCustomOrderInfo/deleteCustomItemOrderInfo")
    Observable<DeleteInfo> deleteCustomOrderItemInfo(
            @Field("zbid") int zbid,
            @Field("prodno") String prodno
    );

//    192.168.1.6:8090/index.php/OpenTeam/InsertCustomOrderInfo/deleteCustomOrderInfo
    @FormUrlEncoded
    @POST("InsertCustomOrderInfo/deleteCustomOrderInfo")
    Observable<DeleteWholeInfo> deleteCustomOrderInfo(
            @Field("id") int id
    );


    /**
     *  客户订单产品信息
     * @param name
     * @param pageSize
     * @return
     */
//    192.168.1.6:8090/index.php/OpenTeam/InsertCustomOrderInfo/queryPbproductInfo?name=彩盒&pageSize=1
    @GET("InsertCustomOrderInfo/queryPbproductInfo")
    Observable<PbProductInfo> queryPbproductInfo(@Query("name") String name,
                                                 @Query("pageSize") int pageSize);

//    192.168.1.6:8090/index.php/OpenTeam/InsertCustomOrderInfo/queryPackTypeInfo?name=&pageSize=0
    @GET("InsertCustomOrderInfo/queryPackTypeInfo")
    Observable<PackTypeInfo> queryPackTypeInfo(@Query("name") String name,
                                               @Query("pageSize") int pageSize);

    //    192.168.1.6:8090/index.php/OpenTeam/InsertCustomOrderInfo/queryCustomInfo?name=&pageSize=0
    @GET("InsertCustomOrderInfo/queryCustomInfo")
    Observable<SomeCustomInfo> querySomeCustomInfo(@Query("name") String name,
                                                   @Query("pageSize") int pageSize);

    // senddate, wraptype, paperinf, technicsinf, printcolor, paynumb, othernumb
//    , price , prodno , id)
    
    @FormUrlEncoded
    @POST("InsertCustomOrderInfo/updateItemInfo")
    Observable<ApprovalStatu> updateCustomOrderItemInfo(
            @Field("id") int id ,@Field("prodno") String prodno
            ,@Field("wraptype") String  wraptype,@Field("paperinf") String  paperinf
            ,@Field("senddate") String  senddate,@Field("technicsinf") String  technicsinf
            ,@Field("printcolor") String  printcolor,@Field("paynumb") String  paynumb
            ,@Field("othernumb") String  othernumb,@Field("price") String  price
            ,@Field("eprodno") String  eprodno
    );


    @FormUrlEncoded
    @POST("InsertCustomOrderInfo/insertItemInfo")
    Observable<ApprovalStatu> insertCustomOrderItemInfo(
            @Field("id") int id ,@Field("prodno") String prodno
            ,@Field("wraptype") String  wraptype,@Field("paperinf") String  paperinf
            ,@Field("senddate") String  senddate,@Field("technicsinf") String  technicsinf
            ,@Field("printcolor") String  printcolor,@Field("paynumb") String  paynumb
            ,@Field("othernumb") String  othernumb,@Field("price") String  price
    );



//    int id, String rdsno, String custid,
//    int userid, String moneyname,
//    String moneytype, String payname,
//    String paytime, String sendname,
//    String sendtype,
//    String custorderid, String alreadlypay,
//    String inputdate, String inputer,
//    String orderamount,
//    String remark, String orderdate, String sendaddress,
//    int istax, String taxrate,   String invtype,
//    String stype
//
    @FormUrlEncoded
    @POST("InsertCustomOrderInfo/updateMainInfo")
    Observable<ApprovalStatu> updateCustomOrderMainInfo(
            @Field("id") int id ,@Field("rdsno") String rdsno
            ,@Field("custid") String  custid,@Field("userid") String  userid
            ,@Field("moneytype") String  moneytype,@Field("paytime") String  paytime
            ,@Field("sendtype") String  sendtype,@Field("custorderid") String  custorderid
            ,@Field("alreadlypay") String  alreadlypay,@Field("inputdate") String  inputdate
            ,@Field("inputer") String  inputer,@Field("orderamount") String  orderamount
            ,@Field("remark") String  remark,@Field("orderdate") String  orderdate
            ,@Field("sendaddress") String  sendaddress,@Field("istax") String  istax
            ,@Field("taxrate") String  taxrate,@Field("invtype") String  invtype
            ,@Field("stype") String  stype
    );



    @FormUrlEncoded
    @POST("InsertCustomOrderInfo/insertMainInfo")
    Observable<ApprovalStatu> insertCustomOrderMainInfo(
             @Field("custid") String  custid
            ,@Field("businessno") String  businessno,@Field("userid") String  userid
            ,@Field("moneytype") String  moneytype,@Field("paytime") String  paytime
            ,@Field("sendtype") String  sendtype,@Field("custorderid") String  custorderid
            ,@Field("alreadlypay") String  alreadlypay,@Field("inputdate") String  inputdate
            ,@Field("inputer") String  inputer,@Field("orderamount") String  orderamount
            ,@Field("remark") String  remark,@Field("orderdate") String  orderdate
            ,@Field("sendaddress") String  sendaddress,@Field("istax") String  istax
            ,@Field("taxrate") String  taxrate,@Field("invtype") String  invtype
            ,@Field("stype") String  stype
    );




}
